package com.lichuang.dedao.curriculum.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lichuang.dedao.curriculum.entity.CurriculumAudition;
import com.lichuang.dedao.curriculum.service.impl.CurriculumAuditionServiceImpl;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 试听 前端控制器
 * </p>
 *
 * @author xiaosong
 * @since 2019-07-22
 */
@RestController
@RequestMapping("//curriculum-audition")
public class CurriculumAuditionController {

    @Autowired
    private CurriculumAuditionServiceImpl curriculumAuditionService;

    @RequestMapping("/insertCurriculumAudition")
    public Integer insertCurriculumAudition(@CookieValue(value = "loginToken", required = false) String loginToken,
                                            CurriculumAudition curriculumAudition){
        return curriculumAuditionService.insertCurriculumAudition(curriculumAudition,loginToken);
    }

    @RequestMapping("/getAllAuditionByUserId")
    public List<CurriculumAudition> getAllAuditionByUserId(@CookieValue(value = "loginToken", required = false) String loginToken){
        return curriculumAuditionService.getAllAuditionByUserId(loginToken);
    }

    @RequestMapping("/getCountByUserIdAndCurriculum")
    public Integer getCountByUserIdAndCurriculum(@CookieValue(value = "loginToken", required = false) String loginToken
            ,@RequestParam("curriculumId")Integer curriculumId, @RequestParam("auditionSectionId")Integer auditionSectionId){
        return curriculumAuditionService.getCountByUserIdAndCurriculum(loginToken,curriculumId,auditionSectionId);
    }

}
